Skip to content

fix(selectors): stop quoting positionals in fill target refusals - #5040

Merged
thymikee merged 2 commits into
callstack:mainfrom
imranbarbhuiya:fix/drag-separator-and-sensitive-fill
Nov 26, 2026
Merged

thymikee merged 2 commits into
callstack:mainfrom
imranbarbhuiya:fix/drag-separator-and-sensitive-fill

Conversation

@imranbarbhuiya

@imranbarbhuiya imranbarbhuiya commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #5027:

  • readFillTargetFromPositionals in packages/selectors/src/interaction-positionals.ts no longer quotes any positional in its refusals (missing target, bare snapshot ref, unknown selector key, or invalid target shape). Any positional of a fill — including --record-as or --text-stdin when a ref variable expands to nothing — may be sensitive text, and the caller already has its own command line. Refusals keep fill_target_missing and the non-echoing hints.
  • Daemon parseFillTarget returns the readFillTargetFromPositionals refusal directly without a sensitive-flag branch or generic fallback, so the CLI and daemon routes produce the same refusal by construction.

Before / after

Base 9f7751eeb, head d74cdf82c:

$ fill $REF pw --record-as PW      # REF unset
base (CLI):        fill_target_missing: fill needs <target> <text> but got one value, "pw". If a ref variable expanded to nothing, the target is missing: pass an @ref from snapshot, a selector, or x y coordinates before the text.
head (CLI/daemon): fill_target_missing: fill needs <target> <text> but got one value. If a ref variable expanded to nothing, the target is missing: pass an @ref from snapshot, a selector, or x y coordinates before the text.

$ fill Email pw --record-as PW
base (CLI):        Target "Email pw" is not a @ref, selector, or "x y" point. To match by visible text, use text="Email pw" (or label=/id=/role=), or pass an @ref from snapshot.
base (daemon):     fill requires x y text, @ref text, or selector text
head (CLI/daemon): Target is not a @ref, selector, or "x y" point. To match by visible text, use text="..." (or label=/id=/role=), or pass an @ref from snapshot.

$ fill e5 pw --record-as PW
base (CLI):        Did you mean "@e5"? Snapshot refs need the @ prefix.
head (CLI/daemon): Snapshot refs need the @ prefix.

Validation

  • Head d74cdf82c, check:affected --base upstream/main --run --head, exactCommit: true: format, lint, typecheck, layering, fallow, build, and vitest-related (92 files, 418 tests) pass.
  • Focused unit tests (5 files, 71 tests) cover every readFillTargetFromPositionals refusal path without quoting positionals, plus matching CLI (interactionCliReaders.fill --record-as) and daemon (runInteraction) refusals; 7 mutants across the decoder and daemon target parser each fail tests.
  • The CLI lines above are from the built CLI at base and head; no device is involved, since decoding happens before dispatch.

@thymikee

Copy link
Copy Markdown
Member

Thanks for the fix. The change at 58e8d48 is ready: separator-only drag endpoints keep their typed refusal, and --record-as fill no longer echoes the fill text. The unit and integration jobs pass, and no conflicts are known. Not blocking, and these can be taken or left: readStdinFillTarget in interactions.ts still keeps its own copy of the "decode a sensitive fill target without quoting" wrapper next to the new selectors helper, so one function could own it; the generic refusal text "fill requires x y text, @ref text, or selector text" is spelled in both interaction-positionals.ts and the daemon fallback and could share one constant; the PR body mentions new daemon tests, but the diff changes none, so either fix the body or add one non-missing shape such as ['Email','pw-secret'] to the existing daemon test; and --record-as fill now loses the bare-ref and selector-key hints, which is the right trade for not echoing text. The Repo Guards failure is in the check-affected SIGTERM test (scripts/check-affected/command-execution.test.ts:35), which this diff does not touch, so it looks unrelated. Re-running that check is all that stands between this head and green. Not verified here: the tests were not run locally, the Repo Guards failure was read from its job log only and not re-run, and the check:affected --run --head claim of 427 tests was not reproduced. No device run is needed, since the change is argument parsing and refusal text before any dispatch.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 23, 2026
@imranbarbhuiya

Copy link
Copy Markdown
Contributor Author
  • Done in fcac053: readSensitiveFillTargetFromPositionals owns the decode-without-quoting wrapper; readStdinFillTarget passes it its own refusal and keeps fill_text_stdin_target_invalid.
  • Done in 2c65c36: FILL_TARGET_SHAPE_MESSAGE in @agent-device/selectors/interaction-positionals is the one spelling, and the daemon fallback imports it.
  • Done in 7f5caef: the daemon test also sends ['Email', 'hunter2'] with --text-stdin and --record-as, and asserts no reason and no text. The body now says the daemon test was extended, not added.
  • Left as is: --record-as fill keeps the generic wording without the bare-ref and selector-key hints, since those hints quote the positionals.

@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 24, 2026
@thymikee

Copy link
Copy Markdown
Member

Thanks for the follow-up fixes. The changes at 7f5caef look good, and the typed refusal for separator-only drag endpoints and the removal of the --record-as fill text echo are both covered by tests that assert the reason or code and the absence of the text. The only check that is not passing is Body rules, which was cancelled rather than failed. It reads the PR description, which this diff does not touch, so it is likely unrelated, and the earlier Repo Guards failure on 58e8d48 is gone, with the other 14 jobs green. Not verified here: the 427-test check:affected claim and the 'each fails with its fix reverted' claim, since tests were not run and regression validity was judged from the diff only. Please re-run the cancelled Body rules check so it reports green, and no conflicts are known.

@thymikee thymikee added ready-for-human Valid work that needs human implementation, judgment, or maintainer merge and removed ready-for-human Valid work that needs human implementation, judgment, or maintainer merge labels Nov 24, 2026
@thymikee

Copy link
Copy Markdown
Member

Thanks for the fixes. The no-echo outcome for fill … --record-as is worth keeping, but it can be done with less code at the owner:

  • Make readFillTargetFromPositionals (packages/selectors/src/interaction-positionals.ts) quote no positionals in any refusal. The caller already has its own command line, so the refusal does not need to repeat it. Then delete readSensitiveFillTargetFromPositionals and its refusal override, and the CLI and daemon routes get the same refusal by construction.
  • Drop the drag-endpoint change. fix(cli): correct three refusals from #5008 #5027 deliberately sent tokens like "170," to the selector checks, and the base error ("Invalid selector term "170,", expected key=value") is already clear; changing it back would flip the same rule a third time.

If other commands with secret input (type, a recorded press with text) quote positionals in refusals, the same decoder change should cover them.

@imranbarbhuiya
imranbarbhuiya force-pushed the fix/drag-separator-and-sensitive-fill branch from 7f5caef to d74cdf8 Compare November 26, 2026 14:25
@imranbarbhuiya imranbarbhuiya changed the title fix(cli): keep the typed refusal for separator-only drag endpoints and stop echoing --record-as fill text fix(selectors): stop quoting positionals in fill target refusals Nov 26, 2026
@imranbarbhuiya

Copy link
Copy Markdown
Contributor Author
  • Rebased onto main (9f7751eeb) and dropped all drag-endpoint changes so drag behavior matches main.
  • Done in d40be76: readFillTargetFromPositionals quotes no positionals in any refusal (missing target, bare ref, unknown selector key, and invalid target shape), keeping fill_target_missing and the non-echoing hints. readSensitiveFillTargetFromPositionals, its refusal override, and FILL_TARGET_SHAPE_MESSAGE are removed.
  • Done in d74cdf8: daemon parseFillTarget returns the readFillTargetFromPositionals refusal directly with no sensitive-flag branch, so the CLI and daemon routes produce the same refusal by construction.
  • Checked type and press:
    • type does not use interaction-positionals.ts and does not accept --record-as or --text-stdin. Its empty-text refusal quotes nothing; its only quoting refusal is in parseTypeTextRequest (packages/daemon/src/execution/type-text-runtime.ts), which echoes a leading @e<digit> token (findMistargetedTypeRefToken) in the message and hint. Left untouched here since it is a separate path without secret-input flags.
    • press has no text payload or secret-input flags (--record-as/--text-stdin). Its CLI decoder (readInteractionTargetFromPositionals) handles target/selector diagnostics only and is pinned by existing press/click/tap tests, so it was left unchanged.

@thymikee

Copy link
Copy Markdown
Member

Thanks for the update. The changes at d74cdf8 look good: fill target refusals no longer quote positionals on either the CLI or the daemon route, the separate sensitive-target wrapper is gone, and the drag-endpoint change is dropped, so both requests to shrink the change are addressed and nothing else is needed from this review.

CI is green; one Body rules run was cancelled right after it started, and a second run on the same commit passed. No conflicts are known.

Not verified here: tests, gates and the built CLI were not run locally, and regression coverage was judged from the base and head code. Not verified here: the check:affected, focused-test and mutant counts in the PR description were not reproduced. No device run is needed, since the changed path is refusal text before any dispatch.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 26, 2026
@thymikee
thymikee merged commit 9d6059c into callstack:main Nov 26, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants